var ec_pie = echarts.init(document.getElementById('pie'));

var ec_pie_option = {
	title: {
        text: '各省现有确诊',
        left : 'left'
    },
	tooltip: {
		trigger:'item',
		formatter:'{a} <br/>{b} : {c} ({d}%)'
	},
	legend: {
		orient: 'vertical',
		right: 'right',
		data: ['甘肃','广东','广西','天津','吉林','上海','福建','四川','安徽','海南','江苏','内蒙古','江西','浙江','山东','云南','北京','河南','重庆','辽宁','湖南','陕西','湖北','黑龙江','贵州','青海','山西','河北','新疆','宁夏','西藏']
	},
	series: [
		{
			name: 'title',
			type: 'pie',
			radius: '55%',
			center: ['50%','60%'],
			data: [],
			emphasis: {
				itemStyle: {
					shadowBlur: 10,
					shadowOffsetX: 0,
					shadowColor: 'rgba(0, 0, 0, 0.5)'
				}
			}
		}
	]
}

// ec_pie.setOption(ec_pie_option)

function pie(){
	$.ajax({
		url: "/pie",
		success: function(data) {
			ec_pie_option.series[0].data = data.mydata
			ec_pie.setOption(ec_pie_option)
		},
		error: function(xhr, type, errorThrown) {

		}
	})
}

pie()